package com.atguigu.app;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class FlinkTest01 {

    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(2);
        DataStreamSource<String> dataStreamSource = env.socketTextStream("hadoop102", 9999);

        SingleOutputStreamOperator<String> singleOutputStreamOperator = dataStreamSource.map(new MapFunction<String, String>() {
            @Override
            public String map(String value) throws Exception {
                return value;
            }
        }).setParallelism(2);

        singleOutputStreamOperator.print("SI>>>>>>>>>");
        singleOutputStreamOperator.broadcast().print("BC>>>>>>>>>").setParallelism(4);
        singleOutputStreamOperator.global().print("GL>>>>>>>>>>").setParallelism(4);
        //singleOutputStreamOperator.forward().print("FO>>>>>>>>>>>>").setParallelism(4);

        env.execute();

    }

}
